//import java.util.Arrays;
import java.util.*;
//import java.util.Date;
import java.sql.*;
import static java.lang.Math.*;

//import static java.lang.System.*;
/**
 * @Author: Lenovo
 * @Date: 2024/5/15 17:10
 * @description:
 */
class Student {

    //字段   成员方法
    private String name;
    private int age;
    private String stuNum;
    public static String classNum="1班";

    {
        this.name="王五";
        System.out.println("实例代码块");
    }
    public Student(String name, int age, String stuNum) {
        this.name = name;
        this.age = age;
        this.stuNum = stuNum;
        System.out.println("构造代码块执行....");
    }
    static {
        classNum="2班";
        System.out.println("静态代码块...");
    }
    //构造方法

    public Student() {
        System.out.println("不带参数的构造方法....");
    }
    public static String getClassNum() {
        return classNum;
    }





    //成员方法
    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return this.name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public String getStuNum() {
        return stuNum;
    }

    public void setStuNum(String stuNum) {
        this.stuNum = stuNum;
    }

    public void show() {
        System.out.println("姓名: " + this.name + " 年龄: " + this.age + " 学号: " + this.stuNum+" 班级:"+classNum);
    }

    public void doClass() {
        func();
        System.out.println(this.name + "正在上课...");
    }
    private void func(){
        System.out.println("private修饰的方法只能在当前类执行...");
    }
    void func1(){
        System.out.println("default修饰的方法在当前包执行...");
    }
}

public class Test {
    public static void main(String[] args) {
        Student student=new Student("zhangsan",20,"111");
        student.show();
    }
    public static void main7(String[] args) {
        {
            int a=10;
            System.out.println(a);
        }
        System.out.println("aaaa");
    }
    public static void main6(String[] args) {
        Student student=new Student("zhangsan",20,"111");
        //student.classNum="1班";
        Student.classNum="1班";
        student.show();
        Student student2=new Student("Lisi",8,"131");
        //student2.classNum="1班";
        student2.show();
        Student student3=new Student();
        student3.show();
    }
    public static void main5(String[] args) {
        Student student=new Student();
        /*student.name="张三";
        student.func();*/
    }
    public static void main4(String[] args) {
        double x = 30;
        double y = 40;
    // 静态导入的方式写起来更方便一些.
    // double result = Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
        double result = sqrt(pow(x, 2) + pow(y, 2));
        System.out.println(result);
        System.out.println("1111");
    }
    public static void main3(String[] args) {
        int[]arr=new int[2];
        System.out.println(Arrays.toString(arr));

        //Date date = new Date();
        // 得到一个毫秒级别的时间戳
         //System.out.println(date.getTime());
    }
    public static void main2(String[] args) {
        Student student=new Student();
        student.setName("zhangsan");
        System.out.println(student.getName());
    }
    public static void main1(String[] args) {
        Student student=new Student("zhangsan",20,"111");
        Student student2=new Student("Lisi",8,"131");
        Student student3=new Student("wangwu",26,"190");
    }
}
